﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace mForum.Domain.Specification
{
    using mForum.Core.Specification;
    using mForum.Domain.DomainObject;

    public class UserUsernameSpecification : Specification<User>
    {
        private string _username;

        public UserUsernameSpecification(string username)
        {
            if(string.IsNullOrEmpty(username))
                throw new ArgumentNullException("username");

            _username = username;
        }

        public override Expression<Func<User, bool>> SatisfiedBy()
        {
            return x => x.Username == _username;
        }
    }
}
